package com.ruoyi.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * 车牌颜色枚举
 */
@Getter
public enum PlateColorEnum {

    BLUE(0, 0, "红色"),
    YELLOW(1, 1, "黄色"),
    WHITE(2, 3, "白色"),
    BLACK(3, 2, "黑色"),
    GREEN(4, 11, "绿色"),
    GREY(5, 2, "黑色"),
    UNKNOWN(-1, 9, "未确定"),
    ;

    /**
     * 摄像机颜色代码
     */
    private final Integer lColorCode;

    /**
     * 区平台颜色代码
     */
    private final Integer pColorCode;

    /**
     * 颜色名称
     */
    private final String colorName;

    PlateColorEnum(Integer lColorCode, Integer pColorCode, String colorName) {
        this.lColorCode = lColorCode;
        this.pColorCode = pColorCode;
        this.colorName = colorName;
    }

    public static PlateColorEnum getEnumByLCode(Integer lColorCode) {
        for (PlateColorEnum instance : values()) {
            if (Objects.equals(instance.getLColorCode(), lColorCode)) {
                return instance;
            }
        }
        return PlateColorEnum.UNKNOWN;
    }
}
